From b9c1953c79688fc3f536b7927692309c9780b5da Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 6 Jan 2022 17:55:24 +0100 Subject: refactor: reuse PostMeta components on single articles/pages --- src/pages/article/[slug].tsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/pages/article/[slug].tsx') diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx index 493f061..e8df85e 100644 --- a/src/pages/article/[slug].tsx +++ b/src/pages/article/[slug].tsx @@ -9,7 +9,7 @@ import { config } from '@config/website'; import { t } from '@lingui/macro'; import { getAllPostsSlug, getPostBySlug } from '@services/graphql/queries'; import { NextPageWithLayout } from '@ts/types/app'; -import { ArticleProps } from '@ts/types/articles'; +import { ArticleMeta, ArticleProps } from '@ts/types/articles'; import { loadTranslation } from '@utils/helpers/i18n'; import { addPrismClasses, translateCopyButton } from '@utils/helpers/prism'; import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next'; @@ -32,6 +32,13 @@ const SingleArticle: NextPageWithLayout = ({ post }) => { title, } = post; + const meta: ArticleMeta = { + author, + commentCount: comments.length, + dates, + thematics, + }; + const router = useRouter(); const locale = router.locale ? router.locale : config.defaultLocale; @@ -51,17 +58,15 @@ const SingleArticle: NextPageWithLayout = ({ post }) => {
- - + +
- +

{t`Comments`}

-- cgit v1.2.3